package com.hongxun.design.ui.dialogstyle;

import android.content.Context;

/**
 * Created by zerdoor_pc on 2016/7/4.
 */
public class LoadUtil {
    static LoadUtil intence;
    Context context;
    LoadingDialog dialog;

    LoadUtil(Context context) {
        this.context = context;
    }

    public static LoadUtil getIntence(Context context) {
        if (intence == null) {
            intence = new LoadUtil(context);
        }
        return intence;
    }

    public void startDialog() {
        if (dialog == null) dialog = new LoadingDialog(context);
        dialog.setCanceledOnTouchOutside(false);
        dialog.show();
    }

    public void close() {
        if (dialog == null) return;
        if (dialog.isShowing()) {
            dialog.dismiss();

        }

    }

    public void setText(String s) {
        //s="数据加载中";
        if (dialog != null && dialog.tv != null) {
            dialog.word = s;
            if (s.length()>8){
                dialog.tv.setTextSize(8);
            }
            dialog.tv.setText(s);
        }
    }
    public void outClear(){
        dialog=null;
        intence=null;
    }
}
